package com.example.hcd.menuactivity;

import com.example.hcd.R;
import com.example.hcd.adapt.ViewUtils;
import com.example.hcd.datamanage.MenuManage;
import com.example.hcd.functionactivity.BaseActivity;
import com.example.hcd.functionactivity.LeaveApplyActivity;
import com.example.hcd.functionactivity.LeaveListActivity;
import com.example.hcd.functionactivity.MyTaskList;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;

public class LeaveMenuActivity extends BaseActivity {
	private LeaveMenuActivity leaveMenuActivity;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.other_menu_view);
		mPageName = "LeaveMenuActivity";
		leaveMenuActivity = this;

		ListView listView = (ListView) findViewById(R.id.list);
		
		TextView title = (TextView)findViewById(R.id.title_content);
		title.setText(this.getString(R.string.leave_manage));
		findViewById(R.id.title_bar_btn_left).setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				
				finish();
			}
		});

		ViewUtils view1 = new ViewUtils(this, R.layout.other_view_item);

		view1.setList(MenuManage.getInstence().getMainMenu(this, MenuManage.getInstence().menu13Id));
		listView.setAdapter(view1);

		listView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				switch (position) {
				case 0:
					Intent intent = new Intent(leaveMenuActivity, LeaveListActivity.class);
					intent.putExtra("TASK_TYPE","all_leave_list");
					startActivity(intent);
					//Toast.makeText(leaveMenuActivity, "请假统计", Toast.LENGTH_SHORT).show();
					break;

				case 1: {
					Intent intent1 = new Intent(leaveMenuActivity, LeaveListActivity.class);
					intent1.putExtra("TASK_TYPE","my_leave_list");
					startActivity(intent1);
					//Toast.makeText(leaveMenuActivity, "我的请假", Toast.LENGTH_SHORT).show();
				}
					break;

				case 2:
					Intent intent2 = new Intent(leaveMenuActivity, MyTaskList.class);
					intent2.putExtra("TASK_TYPE","all_leave_todo");
					startActivity(intent2);
					//Toast.makeText(leaveMenuActivity, "请假待办", Toast.LENGTH_SHORT).show();
					break;
				case 3:
					Intent intent3 = new Intent(leaveMenuActivity, LeaveApplyActivity.class);
					startActivity(intent3);
					//Toast.makeText(leaveMenuActivity, "请假申请", Toast.LENGTH_SHORT).show();
					break;

				default:
					break;
				}
			}
		});

	}

}
